﻿using AutoMapper;
using Guoc.BigMall.Infrastructure.AutoMapper;
using Guoc.BigMall.Infrastructure.Extension;
using Guoc.BigMall.WebService.Dto;
using Guoc.BigMall.Domain.Entity;
using System;

namespace Guoc.BigMall.WebService.MapConfig
{
    public class ObjectMapperConfig : IAutoMapperRegistrar
    {
        public void Register(IMapperConfigurationExpression cfg)
        {
            cfg.CreateMap<SaleOrderCreateDto, SaleOrder>()
                 .Mapping(x => x.OrderId, y => y.Id)
               //.Ignore(m => m.Id)
               .ReverseMap();

            cfg.CreateMap<SaleOrderItemDto, SaleOrderItem>()
             // .Ignore(m => m.Id)
              .ReverseMap();

        }
    }
}